package com.gzhryc.common.data.dto;

import java.util.ArrayList;
import java.util.List;

import com.gzhryc.common.data.ITreeEntity;

public class TreeResult<T> extends BaseResponse<TreeResult.Body<T>> {

	private static final long serialVersionUID = 8044377182473416825L;

    public TreeResult(Integer code){
        this.code = code;
        this.body = new TreeResult.Body<>();
    }
    
    public TreeResult(Integer code,String msg){
        this.code = code;
        this.msg = msg;
        this.body = new TreeResult.Body<>();
    }

	public static class Body<T> {
		
		private List<T> data;
		
		public Body() {
			this.data = new ArrayList<T>();
		}
		
		public List<T> getData() {
			return data;
		}
		public void setData(List<T> data) {
			this.data = data;
		}
	}

	public static class TreeNode implements ITreeEntity<TreeNode, String> {

		private static final long serialVersionUID = 1L;
		
		private String id;
		private String name;
		private String parentId;
		private List<TreeNode> children;

		public String getName() {
			return name;
		}

		public void setName(String name) {
			this.name = name;
		}

		public void setId(String id) {
			this.id = id;
		}

		public void setParentId(String parentId) {
			this.parentId = parentId;
		}

		@Override
		public String getId() {
			return id;
		}

		@Override
		public String getParentId() {
			return parentId;
		}

		@Override
		public List<TreeNode> getChildren() {
			return children;
		}

		@Override
		public void setChildren(List<TreeNode> children) {
			this.children = children;
		}


	}
}
